import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

def plot1():
    ts = pd.Series(np.random.randn(100), index=pd.date_range('1/1/2000', periods=100))
    ts = ts.cumsum()
    print(ts)
    ts.plot()
    plt.show()

def plot2():
    ts = pd.Series(np.random.randn(100), index=pd.date_range('1/1/2000', periods=100))
    ts = ts.cumsum()
    df = pd.DataFrame(np.random.randn(100, 4), index=ts.index, columns=list('ABCD'))
    df = df.cumsum()
    #plt.figure()
    df.plot()
    plt.show()

def plot3():
    df3 = pd.DataFrame(np.random.randn(100, 2), columns=['B', 'C']).cumsum()
    df3['A'] = pd.Series(list(range(100)))
    print(df3)
    df3.plot(x='A', y=['B', 'C'])
    plt.show()

def plot4():
    df = pd.DataFrame(np.arange(12).reshape(4, 3), columns=['A', 'B', 'C'])
    styles = ['bs-', 'ro-', 'y^-']
    linewidths = [2, 1, 4]
    fig, axes = plt.subplots(nrows=3)
    print(fig, axes)
    axes[0].set_ylim(0,20)
    for col, style, lw, ax in zip(df.columns, styles, linewidths, axes):
        df[col].plot(style=style, lw=lw, ax=ax)
    plt.show()

if __name__ == '__main__':
    op = 4
    if op == 1:
        plot1()
    elif op == 2:
        plot2()
    elif op == 3:
        plot3()
    elif op == 4:
        plot4()
    else:
        pass
